/*
 * Created: 2022-08-27 16:29:55
 * Author : 涛涛涛
 */

import React, { FC } from 'react';
import { View, Text } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import Taro from '@tarojs/taro';
export interface IProps extends ICompProps {
    testType: keyof typeof handleMapper;
}
const handleMapper = {
    gotoArtwordExhibition: () => {
        Taro.redirectTo({
            url: '/pages/ProductExhibition/ProductExhibition',
        });
    },
    gotoHome: () => {
        Taro.redirectTo({
            url: '/pages/Home/Home',
        });
    },
};
TestButton.defaultProps = {} as Partial<IProps>;
function TestButton(props: IProps) {
    const { className, style } = props;
    const localClassName = useClassName('TestButton', className);
    const handleClick = () => {
        handleMapper[props.testType]();
    };

    return (
        <RootView className={localClassName} style={style} onClick={handleClick}>
            测试按钮
        </RootView>
    );
}
export default React.memo(TestButton as FC<IProps>);
const RootView = styled(View)`
    &.TestButton {
        top: 0;
        left: 0;
        position: fixed;
        font-size: 24px;
        z-index: 99999999;
        background-color: red;
        color: #fff;
    }
`;
